const sass = require('gulp-sass');
const gulp = require('gulp')

sass.compiler = require('node-sass')

gulp.task('sass', () => {
  return gulp.src('./src/sass/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('./build'))
})

gulp.task('sass:watch', async () => {
  gulp.watch('./src/sass/**/*.scss', async () => {
    gulp.src('./src/sass/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('./build'))
  })
})


gulp.task('default', gulp.parallel('sass', 'sass:watch'))